package com.example.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class OrderService {
    @Autowired
    private UserService userService;

    private Map<String, List<Integer>> userOrders;

    public Map<String, Integer> getUserOrderByIdx(String username, int idx) {
        Map<String, Integer> order = new HashMap<>();
        order.put(username, userOrders.get(username).get(idx));
        return order;
    }

    public void initOrder() {
        userOrders = new HashMap<>();
        userOrders.put(userService.getUsername(), Arrays.asList(1,2,3,4,5));
    }
}
